package com.xin.data.simbapesa;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;

import com.xin.data.simbapesa.analysis.AnalysisUtil;
import com.xin.data.simbapesa.obj.SimbaAppInfo;
import com.xin.data.simbapesa.obj.SimbaPointInfo;
import com.xin.data.simbapesa.obj.SimbaUserProcess;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class SimbaApp extends Application {


    @SuppressLint("StaticFieldLeak")
    private static SimbaApp app;

    private final List<Activity> lists = new ArrayList<>();

    private SimbaUserProcess process;

    private SimbaAppInfo appInfo;

    private boolean isScore;

    private boolean isOrder;

    Context context;


    String[] deviceInfoTypes;


    HashMap<String, SimbaPointInfo> pointList = new HashMap<>();

    boolean isInitPointList;

    int pointListId;

    String PageType="";


    public void addActivity(Activity activity) {
        lists.add(activity);
    }

    public void clearActivity() {
        for (Activity activity : lists) {
            activity.finish();
        }
        lists.clear();
    }



    public static SimbaApp getInstance() {
        return app;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
//                FirebaseApp.initializeApp(this);
        AnalysisUtil.INSTANCE.initOnLaunch(this);
    }

    public SimbaUserProcess getProcess() {
        return process;
    }

    public void setProcess(SimbaUserProcess process) {
        this.process = process;
    }


    public static SimbaApp getApp() {
        return app;
    }

    public static void setApp(SimbaApp app) {
        SimbaApp.app = app;
    }

    public List<Activity> getLists() {
        return lists;
    }

    public SimbaAppInfo getAppInfo() {
        return appInfo;
    }

    public void setAppInfo(SimbaAppInfo appInfo) {
        this.appInfo = appInfo;
    }

    public boolean isScore() {
        return isScore;
    }

    public void setScore(boolean score) {
        isScore = score;
    }

    public boolean isOrder() {
        return isOrder;
    }

    public void setOrder(boolean order) {
        isOrder = order;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public String[] getDeviceInfoTypes() {
        return deviceInfoTypes;
    }

    public void setDeviceInfoTypes(String[] deviceInfoTypes) {
        this.deviceInfoTypes = deviceInfoTypes;
    }

    public HashMap<String, SimbaPointInfo> getPointList() {
        return pointList;
    }

    public void setPointList(HashMap<String, SimbaPointInfo> pointList) {
        this.pointList = pointList;
    }

    public boolean isInitPointList() {
        return isInitPointList;
    }

    public void setInitPointList(boolean initPointList) {
        isInitPointList = initPointList;
    }

    public int getPointListId() {
        return pointListId;
    }

    public void setPointListId(int pointListId) {
        this.pointListId = pointListId;
    }

    public String getPageType() {
        return PageType;
    }

    public void setPageType(String pageType) {
        PageType = pageType;
    }




}
